package com.lxj.aspect;

import com.lxj.domain.Group;
import com.lxj.domain.GroupMember;
import com.lxj.mapper.GroupMemberMapper;
import org.aspectj.lang.JoinPoint;;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("GroupServiceAspect")
@Aspect
public class GroupServiceAspect {
    @Autowired
    private GroupMemberMapper groupMemberMapper;
    //com.lxj.service.impl
    @Before("execution(* com.lxj.service.impl.GroupServiceImpl.edit(..))")
    public void updateIsLeader(JoinPoint joinPoint){
        Object[] args = joinPoint.getArgs();
        Group group =(Group)args[0];
//        Integer id = args[0].getId();
        groupMemberMapper.update(group);
    }
}
